home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_300
/
304_01
/
roff5.doc
< prev
next >
Wrap
Text File
|
1990-02-12
|
47KB
|
1,314 lines
August 29, 1989
ROFF5, V2.00
by Ernest E. Bergmann
730 Seneca Street
Bethlehem, PA 18015
ROFF5 is a major revision of my earlier formatter,
ROFF4, v1.61. It has been written in Turbo C, v2.0 (MS-DOS)
for greater portability. It has many significant extensions.
However, some of the old commands have been changed in order
to more closely align with the venerable formatters: nroff
and troff. Many of the exceptions are due to the influence of
WORDSTAR [tm by MicroPro] or personal taste.
ROFF4 is an expanded version of ROFF, based on the
formatter in Kernighan and Plauger's book SOFTWARE TOOLS, is
written in BDS C, and employs the directed i/o functions
that go along with that package. Well, half of the directed
I/O anyway - it doesn't use redirected input because more
than one file can be used as input for a run. So that some
of the input files may be used to "set-up" the formatter for
a particular style and for particular hardware. It is
possible to substitute keyboard input instead of files for
educational and test purposes.
ROFF was provided by Neal Somos for the public
domain via the BDS 'C' Users' Group's volume, CUG -- "Just
Like Mom's". Some of this documentation started there as
well.
This formatter contains features important for the
preparation of technical manuscripts. Special symbols or
fonts that can be defined by or for the user can be produced
(if the hardware is capable!). Super and subscripts can be
handled as well as backspace even for printers without
reverse scrolling or backspacing hardware capabilities.
However, the output device should recognize separately the
<CR> and <LF> functions.
Because of the strong similarity to the nroff and troff of
UNIX[R by AT&T], documentation of those formatters would be relevent
here. In particular, I recommend the paperback book, "troff
Typesetting for UNIX[TM] Systems," by S. L. Emerson and K. Paulsell,
ISBM 0-13-930959-4. I have tried to avoid using command names that
are inconsistent with troff, but I have not strictly followed the
same conventions because I place a higher premium on longer names
for ease of documentation and I want to directly drive simple
devices such as a variety of dot matrix printers with special
symbols that are sometimes needed in technical manuscripts. I have
personally used ROFF4 and ROFF5 for dozens of manuscripts. I have
thus located and fixed bugs and determined features that appeared to
make sense.
"Preprocessor" files and directives can be used to merge
stock phrases, boiler plate, make macro definitions, automate
numbering, and create diversions (for footnotes, table of
contents, etc.)
To support the capabilities of WORDSTAR[tm by
MicroPro] extended underlining, strikeout, and multiple
strike capability are provided as well.
-----------------------------------------------------------------
The MS-DOS version uses the curly-bracket character '}'
to redirect output, and only one target may be
specified. Thus:
a>roff5 filename1 filename2 }outfile
would format filename1 and filename2 and write the output
on a file "outfile" on the default drive. If there is no
target specified, the default output is the console.
The more conventional character '>' is not used because
MS-DOS 2.x intercepts any '>' or '<' on the command
line and redirects all output to the specified target,
even output which the program addressed to 'stderr'.
_________________________________________________________________
A>roff5 -s -f filename1 filename2 -f -m -r -i -g -*
The option, -s, causes the formatter to stop (pause)
at the start of each page of output; the bell at the
console is sounded (if it exists!) and the program
waits until any key is pressed at the console. It
is essential for printers that are feed single sheets
at a time!
An option that was not shown above, -o[page or range],
is used to selectively generate output of ONLY certain
pages. It is useful to retype pages that got "eaten"
by the printer (Henry Harpending's aptly put language).
To retype only page 23, say, make the option: -o23
To retype pages 23 through 29 use: -o23-29
To retype pages 23 to the end use: -23-
These options changes the values of the internal
variables, FIRSTPAGE and LASTPAGE which originally
have the values of 1 and 30000, respectively. Normally
this option would be placed early enough in the
command line that no pages have been printed yet.
Another option that was not shown above, -n[page#],
is used to change the default starting page number.
The option, -f, would introduce a formfeed (0CH)
into the output stream (useful for placing blank
pages, or aligning printer pages) where it appears;
in this example, before the first page of output,
and, again, at the very end of the output.
The option, -m, causes a list of macro definitions
to be typed to the console. It is a useful tool for
debugging complex macro packages where the
preprocessor's expansions are too subtle for humans.
The option, -i, causes a list of string insertions
to be typed to the console. Useful for macro writers,
as was the -m, described above. Also, for noting
what are the settings of "standard substitutions",
such as "today's date".
The option, -r, causes a list of number registers to
be typed to the console. Could be useful to find
the number of footnotes, etc.
The option, -g, causes a glossary of defined
translated characters to be printed on the output
device. It is useful to check the appearance of
all special definable characters and to produce
a "wall chart" of special characters available.
The default option, -*, (the * could be any
unassigned option) means keyboard input (buffered
line-by-line with a prompt with the character used in
the option, here *). Typing a control-Z indicates
an end-of-file; the formatter will continue with the
next named file. It is intended as a learning aid
since one can tryout "tricky" input such as
equations. As with standard CP/M and MS-DOS, a
control-P can be used to toggle the printer to
display output that would normally be sent to the
console; also, one can edit the keyboard input with
the backspace key.
Using ROFF5, you can make nice printouts of a file,
with as little or as much help from the program as you want,
depending on the commands. There are default values for all
parameters, so if you don't put any commands in at all, your
file will come out with filled, right-justified lines. The
default line-length is 66 characters and we have defaulted the
conventional tab stops to every fifth column; the default page-
length is 66 lines per page. "Filled lines" means that as
many input words as possible are packed onto a line before
it is printed; "non-filled" lines go through the formatter
w/o rearrangement. "Right-justified" simply means that
spaces are added between words to make all the right margins
line up nicely. To set a parameter, use the appropriate
commands below. All commands have the form of a period
followed by one or two characters; any non-blank contiguous
non-blank characters following a recognized command will be
passed over by the formatter. Thus, ".else" could be used
instead of ".el". A command line should have
nothing on it but the command and its arguments (if any);
any text would be lost.
Extra space will separate text sentences. The sentence
is recognized by a trailing ':',';','!','?', or a '.'. For
the '.' there is the additional requirement that either two
or more spaces must follow it, or that it is at the end of
the source line.
A command argument can be either ABSOLUTE or RELATIVE :
.ls 5 sets the line spacing to 5
.ls +5 sets the line spacing to the CURRENT value+5
.ls -1 sets the line spacing to the CURRENT value-1
Also, all commands have a minimum and maximum value
that will weed out any odd command settings (like setting
the line spacing to zero, for example. It won't let you do
that,